/**
 * caicongyang.com Inc.
 * Copyright (c) 2004-2017 All Rights Reserved.
 */
package com.caicongyang.design.composite;

/**
 * @author caicongyang1
 * @version id: Leaf, v 0.1 17/5/18 下午7:46 caicongyang1 Exp $$
 */
public class Leaf extends Component {

    public Leaf(String name) {
        super(name);
    }

    @Override
    public void add(Component component) {
        System.out.println("leaf can't  add component");
    }

    @Override
    public void remove(Component component) {
        System.out.println("leaf don't remove component");
    }

    @Override
    public void dispay(int detph) {
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < detph; i++) {
            stringBuilder.append("-");
        }
        stringBuilder.append(super.getName());
        System.out.println(stringBuilder.toString());
    }
}
